<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function fun(){
				var r= Math.floor(Math.random()*256)  /*0~n    m~n*/
				var g= Math.floor(Math.random()*256)
				var b= Math.floor(Math.random()*256)
				var color="rgb("+r+","+g+","+b+")"
				document.querySelector("body").setAttribute("style","background-color: "+color+";")
				document.querySelector("span").innerHTML=color
			}
		</script>
	</head>
	<body>
		<button onclick="fun()">随机背景色</button>
		<span>rgb(255,255,225)</span>
	</body>
</html>
